<?php defined('IN_YuLin') || exit('NO PERMIT!'); ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>文章信息 - 后台管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <link rel="stylesheet" type="text/css" href="static/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="static/css/style.css">
</head>
<body>
<div class="subnav">
    <a href="">首页</a> &gt; <a href="">客户管理</a> &gt; 登陆ip设置
</div>

<div class="main-inner">
    <div class="x-body">
        <div class="tablefilter">
            <div class="tablebutton">
                <a href="?m={$m}&c={$c}&a=add&id=3" class=""><i class="fa fa-plus"></i>新增</a>
                <a class="chooseAll"><i class="fa fa-check"></i>全选</a>
                <a class="delete"><i class="fa fa-trash"></i>删除</a>
            </div>
        </div>

        <table class="layui-table">
            <thead>
            <tr>
                <th>选择</th>
                <th>id</th>
                <th>ip</th>
                <th>描述</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="datalist">
            {loop $data as $val}
            <tr>
                <td>
                    <input type="checkbox" value="{$val['id']}" />
                </td>
                <td>{$val['id']}</td>
                <td>{$val['ip']}</td>
                <td>{$val['describe']}</td>
                <td><a href="{U('admin/ip/edit',[id=>$val['id']] )}">修改</a> </td>
            </tr>
            {/loop}
            </tbody>
        </table>
        <div class="layui-clear">
            <div id="pages" class="layui-laypage right">{$multi}</div>
        </div>
    </div>
</div>
<script type="text/javascript" src="static/js/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        var oBtn = false;
        $(".chooseAll").on('click',function(){
            if(!oBtn){
                $("input[type=checkbox]").prop('checked',true);
                oBtn = true;
            }else{
                $("input[type=checkbox]").prop('checked',false);
                oBtn = false;
            }
        })

        $(".delete").on('click',function(){
            var ids = [];
            $("input[type=checkbox]:checked").map(function(){
                ids.push($(this).val());
            });
            if(!ids.length){
                alert('当前没有可操作的元素');return;
            }
            $.ajaxSetup({async:false});
            $.post("?m=admin&c=ip&a=del",{ids:ids},function(res){
                res = eval('('+res+')');
                alert(res.msg);
                window.location.reload();
            });
        });
    })
</script>
</body>
</html>
